<?php

namespace app\server;

class ToolServer
{
    public function getTodayMap(){
        $now = time();
        return ['create_at','between',[date('Y-m-d 00:00:00',$now),date('Y-m-d 23:59:59',$now)]];
    }

    /**
     * 将数组中的某一个字段作为key返回
     *
     * @param $list
     * @param $column
     * @return array
     */
    public static function arrayKeyList($list,$column): array
    {
        $arr = [];
        foreach($list as $value){
            $arr[$value[$column]] = $value;
        }
        return $arr;
    }

    // 将传参转成数组化
    public function splitParamLink($url)
    {
        $paramsArr = [];
        $arr = explode('&', $url);
        foreach ($arr as $value) {
            $split = explode('=', $value);
            if (count($split) == 2) {
                $key = $split[0];
                if (strpos($key, '?') !== false) {
                    $key = explode('?', $key)[1];
                }
                $paramsArr[$key] = $split[1];
            }
        }
        return $paramsArr;
    }
}

?>